local beilie = fk.CreateSkill{
    name = "lingling__beilie",
    tags = {Skill.Quest}
}
Fk:loadTranslationTable{
    ["lingling__beilie"] = "悲烈",
    [":lingling__beilie"] = "使命技，当你进入濒死状态后，你回复4点体力。"..
    "<br>成功：若你因受到伤害进入濒死状态，你删除“难终”<font color='#009cff'>蓝色</font>描述。"..
    "<br>失败：若你因失去体力进入濒死状态，你删除“难终”<font color='red'>红色</font>描述。",
    ["@@lingling__beilie-success"] = "悲烈成功",
    ["@@lingling__beilie-fail"] = "悲烈失败",
    ["$lingling__beilie1"] = "凶德根于心，弗得其所辄发，惜哉！",
    ["$lingling__beilie2"] = "木朽而虫乃生，墙坏而蠹始入，势也！",
}

beilie:addEffect(fk.EnterDying, {
    anim_type = "big",
    can_trigger = function(self, event, target, player, data)
        if target == player and player:hasSkill(beilie.name) and
        player:getMark("@@lingling__beilie-success") == 0 and player:getMark("@@lingling__beilie-fail") == 0 and
        not target.dead and target.dying then
            return true
        end
    end,
    on_cost = Util.TrueFunc,
    on_use = function (self, event, target, player, data)
        local room = player.room
        room:recover{
            who = player,
            skillName = beilie.name,
            num = 4,
        }
        if not data.damage then
            local losehp_event = player.room.logic:getCurrentEvent():findParent(GameEvent.LoseHp)
            if losehp_event and losehp_event.data.who == target then
                room:updateQuestSkillState(player, beilie.name, true)
                room:setPlayerMark(player, "@@lingling__beilie-fail", 1)
            end
        else
            room:updateQuestSkillState(player, beilie.name, false)
            room:setPlayerMark(player, "@@lingling__beilie-success", 1)
        end
    end,
})

--[[beilie:addEffect("prohibit", {
    is_prohibited = function (self, from, to, card)
        return card and card.trueName == "peach" and to and from and from:getMark("@@lingling__beilie") > 0 and from ~= to
    end,
})]]--

return beilie